<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
</head>
<style>
    .parent {
        width: 400px;
        height: 400px;
        padding: 50px;
        margin: 100px;
        background-color: #f20;
    }
    
    .child {
        width: 200px;
        height: 200px;
        padding: 50px;
        background-color: #ff0;
    }
    
    .child-child {
        width: 50px;
        height: 50px;
        background-color: #00d;
    }
</style>

<body>
    <script>
        window.onload = function() {
            let parent = document.getElementById("parent");
            parent.addEventListener("click", function(event) {
                console.info(event.offsetX);
            });
        };
    </script>
    <div class="parent" id="parent">
        <div class="child">
            <div class="child-child"></div>
        </div>
    </div>
</body>

</html>